<?php

function getBrowser () {
    if (strstr($_SERVER['HTTP_USER_AGENT'], 'Opera')) {
        $browser = @sereg_replace(".+\(.+\) (Opera |v){0,1}([0-9,\.]+)[^0-9]*", "Opera \\2", $_SERVER['HTTP_USER_AGENT'] );

        if (ereg('^Opera/.*', $_SERVER['HTTP_USER_AGENT'] ) ) {
            $browser = @ereg_replace("Opera/([0-9,\.]+).*", "Opera \\1", $_SERVER['HTTP_USER_AGENT'] );
        }
    }
	elseif (strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
        $browser = @ereg_replace(".+\(.+MSIE ([0-9,\.]+).+", "Internet Explorer \\1", $_SERVER['HTTP_USER_AGENT'] );
	}
    elseif (strstr($_SERVER['HTTP_USER_AGENT'], 'Firefox')) {
        $browser = @ereg_replace(".+\(.+rv:.+\).+Firefox/(.*)", "Firefox \\1", $_SERVER['HTTP_USER_AGENT'] );
    }
    elseif (strstr($_SERVER['HTTP_USER_AGENT'], 'Mozilla')) {
        $browser = @ereg_replace(".+\(.+rv:([0-9,\.]+).+", "Mozilla \\1", $_SERVER['HTTP_USER_AGENT'] );
    }
    else {
        $browser = $_SERVER['HTTP_USER_AGENT'];
    }

    return $browser;
}

?>